﻿using System;
using Company.BLL;
using Company.BLL.GC;
using Company.BLL.Utils;
using Company.BLL.DuLieuChuan;


namespace Company.Interface.GC.PCTFormTemplate
{
    public partial class PKGiahanHDFormRegister : BaseForm
    {
        public PhuKienDangKy pk;
        public string FormName;
        public PKGiahanHDFormRegister()
        {
            InitializeComponent();
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }


        private void txtMaHS_Leave(object sender, EventArgs e)
        {
            if (!MaHS.Validate(txtMaHS.Text, 10))
            {
                error.SetIconPadding(txtMaHS, -8);
                error.SetError(txtMaHS, "Mã số HS không hợp lệ.");
            }
            else
            {
                error.SetError(txtMaHS, string.Empty);
            }
        }

        private void PKGiahanHDForm_Load(object sender, EventArgs e)
        {
            txtThongTinMoi.Visible = false;
            label15.Visible = false;
            pk.Load();
            this.Text = FormName;
            if (pk.MaPhuKien.Trim() == "H06")
            {
                txtThongTinMoi.Visible = true;
                label15.Visible = true;
                txtThongTinMoi.Text = pk.ThongTinMoi;               
            }
           
            txtGhiChu.Text = pk.GhiChu;
            txtVBCP.Text = pk.VBCP;         
            txtMaDV.Text = GlobalSettings.MA_DON_VI;
            txtTenDv.Text = GlobalSettings.TEN_DON_VI;
            txtSoHopDong.Text = pk.SoHopDong;
            txtSoPhuKien.Text = pk.SoPhuKien;
            ccNgayKyHD.Text = pk.NgayKy.ToShortDateString();
            ccNgayPhuKien.Text = pk.NgayPhuKien.ToShortDateString();
            ctrDonViHaiQuan.Ma = pk.MahaiQuan;
            
        }     
    }
}
